import request from "@/api/config/request_v3";

/**
 * 商品三级分类
 * @param url
 * @param params
 * @returns
 */
export const getBaseCategoryList = (): Promise<any> => request.get('/api/product/getBaseCategoryList');

/**
 * 搜索商品
 * @param data
 * @returns
 */
export const searchProduct = (data: {
	category1Id?: string,
	category2Id?: string,
	category3Id?: string,
	categoryName?: string,
	keyword?: string,
	/**
	 * 商品属性的数组: ["属性ID:属性值:属性名"]
	 * 示例: ["2:6.0～6.24英寸:屏幕尺寸"]
	 */
	props?: Array<string>,
	/**
	 * 品牌，格式为 品牌id:品牌名称，示例
	 * 1:华为
	 */
	trademark?: string,
	order?: string,
	pageNo?: number,
	pageSize?: number
}): Promise<any> => {
	return request({
		url: '/api/list',
		method: 'post',
		data
	})
}

/**
 *获取商品详情
 * @param skuId
 */
export const getSkuDetail = (skuId: string): Promise<any> => {
	return request.get(`/api/item/${skuId}`)
}